# -* -coding: utf-8 -*-
import random
import requests
import win32api
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
import time,json,threading
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys

options = webdriver.ChromeOptions()
options.binary_location = r"C:\Chrome\Chrome.exe"
options.add_argument('--disable-gpu') #谷歌文档提到需要加上这个属性来规避bug
options.add_experimental_option('excludeSwitches', ['enable-automation'])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(r'C:\Chrome\Chromedriver.exe',options=options)
driver.maximize_window()
driver.get("https://www.taobao.com/?spm=a2107.1.0.0.f34811d91Nh66C")
driver.implicitly_wait(30)
driver.find_element_by_xpath("//div[@class=\"site-nav-sign\"]/a").click()
time.sleep(5)
driver.find_element_by_xpath("//*[@id=\"fm-login-id\"]").send_keys("jianlong918918")
time.sleep(5)
driver.find_element_by_xpath("//*[@id=\"fm-login-password\"]").send_keys("YUtaitai521")
time.sleep(5)
driver.find_element_by_xpath("//div[@class=\"fm-btn\"]/button").click()